package com.momo.web.controller.sysSetting;

import com.momo.common.common.JSONResult;
import com.momo.common.req.sysSetting.authority.AclModuleReq;
import com.momo.service.sysSetting.SysAclModuleService;
import com.momo.web.controller.BaseController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.io.UnsupportedEncodingException;

/**
 * Created by Kagome on 2019/3/19.
 * 权限模块管理
 */
@RestController
@RequestMapping(value = "/platform/aclModule", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@Slf4j
public class SysAclModuleController extends BaseController {
    @Autowired
    private SysAclModuleService sysAclModuleService;

    @RequestMapping("/add/v1")
    public JSONResult add(@Validated(AclModuleReq.Add.class) @RequestBody AclModuleReq aclModuleReq) {
        return sysAclModuleService.add(aclModuleReq, redisUser());
    }

    @RequestMapping("/modify/v1")
    public JSONResult modify(@Validated(AclModuleReq.Modify.class) @RequestBody AclModuleReq aclModuleReq) {
        return sysAclModuleService.modify(aclModuleReq, redisUser());
    }

    @RequestMapping("/status/v1")
    public JSONResult status(@Validated(AclModuleReq.Status.class) @RequestBody AclModuleReq aclModuleReq) {
        return sysAclModuleService.status(aclModuleReq, redisUser());
    }

    @RequestMapping("/detail/v1")
    public JSONResult detail(@Validated(AclModuleReq.Detail.class) @RequestBody AclModuleReq aclModuleReq) {
        return sysAclModuleService.detail(aclModuleReq);
    }
}
